﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace DARE
{
    /// <summary>
    /// 
    /// </summary>
    public class ALoadHelper
    {
        #region Fields

        private string m_path;

        #endregion

        #region Property

        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer]
        public string Path
        {
            get { return this.m_path; }
            set
            {
                if (value != this.m_path)
                {
                    string last = this.m_path;
                    this.m_path = value;
                    ReLoad(last);
                }
            }
        }

        #endregion

        #region Event

        /// <summary>
        /// 
        /// </summary>
        public event DataEvent<string> Reloaded;

        #endregion

        #region CTOR

        /// <summary>
        /// 
        /// </summary>
        public ALoadHelper()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        public ALoadHelper(string _path)
        {
            Path = _path;
        }

        #endregion

        #region Method

        /// <summary>
        /// 
        /// </summary>
        /// <param name="lastPath"></param>
        protected virtual void ReLoad(string lastPath)
        {
            if (Reloaded != null)
                Reloaded.Invoke(lastPath);
        }

        #endregion
    }
}
